//
//  HelpViewController.m
//  PigMarket
//
//  Created by mac on 2019/3/20.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "HelpViewController.h"
#import "SystemSetingCell.h"

@interface HelpViewController ()<UITableViewDataSource,UITableViewDelegate>

/**
 myTableView
 */
@property (nonatomic , strong) UITableView *myTableView;

/**
 dataArr
 */
@property (nonatomic , strong) NSArray *dataArr;
@end

@implementation HelpViewController


#pragma mark - view life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    self.baseNavView.navTitleLabel.text = @"帮助";
    self.myTableView.separatorColor = mIconLineColor;
    [self setUpView];
}


#pragma mark - init method
- (void)setUpView {
    [self initView];
    [self initLayout];
    [self initAction];
    [self initData];
}
- (void)initView {
    [self.view addSubview:self.myTableView];
}

- (void) initLayout {
    [self.myTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(self.baseNavView.bottom);
    }];
}

- (void) initAction {
    
}

- (void)initData {
    self.dataArr = @[@{@"title":@"领养规则"},
                     @{@"title":@"购物指南"},
                     @{@"title":@"屠宰、分割、配送"},
                     @{@"title":@"售后服务"},
                     @{@"title":@"新手政策"}];
}

#pragma mark - delegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 5;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 5;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return [[UIView alloc] init];
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    return [[UIView alloc] init];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    SystemSetingCell *cell = [SystemSetingCell cellWithTableView:tableView];
    cell.infoDic = self.dataArr[indexPath.row];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
}
#pragma mark - target action

#pragma mark - private method

#pragma mark - getter and setter
- (UITableView *)myTableView {
    if (!_myTableView) {
        _myTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
        _myTableView.rowHeight = 54;
        _myTableView.delegate = self;
        _myTableView.dataSource = self;
        
    }
    return _myTableView;
}
- (NSArray *)dataArr {
    if (!_dataArr) {
        _dataArr = [[NSArray alloc] init];
    }
    return _dataArr;
}
@end

